"use strict";
var icons = require("./icons.js");
var Locale = require("element-ui/src/mixins/locale");
var license = require("../utils/license");
function _interopDefaultLegacy(e) {
  return e && typeof e === "object" && "default" in e ? e : { "default": e };
}
var icons__default = /* @__PURE__ */ _interopDefaultLegacy(icons);
var Locale__default = /* @__PURE__ */ _interopDefaultLegacy(Locale);
var render = function() {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("el-popover", { attrs: { "width": _vm.width, "popper-class": "ele-icon-picker-popper", "placement": "bottom-start", "transition": "el-zoom-in-top", "disabled": _vm.disabled }, on: { "show": _vm.afterEnter, "hide": _vm.afterLeave }, model: { value: _vm.show, callback: function($$v) {
    _vm.show = $$v;
  }, expression: "show" } }, [_vm.authenticated ? _c("div", { class: _vm.pickerClass, attrs: { "slot": "reference" }, slot: "reference" }, [_vm._t("default", function() {
    return [_vm.theme === "style2" ? _c("el-input", { attrs: { "value": _vm.value, "placeholder": _vm.placeholder, "clearable": _vm.clearable, "disabled": _vm.disabled, "size": _vm.size }, on: { "focus": _vm.setReadonly, "clear": _vm.clear } }, [_c("template", { slot: "append" }, [_c("i", { class: _vm.value })])], 2) : _vm.theme === "style3" ? _c("el-input", { attrs: { "prefix-icon": _vm.value, "disabled": _vm.disabled, "size": _vm.size, "readonly": "readonly" } }, [_c("template", { slot: "append" }, [_c("i", { staticClass: "el-icon-arrow-down" })])], 2) : _c("el-input", { attrs: { "value": _vm.value, "prefix-icon": _vm.value, "placeholder": _vm.placeholder, "clearable": _vm.clearable, "disabled": _vm.disabled, "size": _vm.size, "suffix-icon": "el-icon-arrow-down" }, on: { "focus": _vm.setReadonly, "clear": _vm.clear } })];
  }, { "show": _vm.show, "value": _vm.value })], 2) : _vm._e(), _c("el-tabs", { model: { value: _vm.active, callback: function($$v) {
    _vm.active = $$v;
  }, expression: "active" } }, _vm._l(_vm.result, function(item, index2) {
    return _c("el-tab-pane", { key: index2, attrs: { "label": item.title, "name": item.title } }, [_vm.listShow ? _c("el-scrollbar", { staticStyle: { "height": "225px" } }, [_c("el-row", _vm._l(item.icons, function(d, i) {
      return _c("el-col", { key: i, attrs: { "span": 4 } }, [_c("el-card", { staticClass: "ele-card-border", attrs: { "shadow": "hover", "title": d } }, [_c("div", { staticClass: "ele-icon-picker-item", on: { "click": function($event) {
        return _vm.choose(d);
      } } }, [_c("i", { class: d })])])], 1);
    }), 1)], 1) : _c("div", { staticStyle: { "height": "225px", "line-height": "225px", "text-align": "center" } }, [_vm._v(" " + _vm._s(_vm.t("el.select.loading")) + ".. ")])], 1);
  }), 1), _vm.search ? _c("el-input", { staticClass: "ele-icon-picker-search", attrs: { "placeholder": _vm.searchPlaceholder, "size": "mini", "suffix-icon": "el-icon-search" }, model: { value: _vm.keywords, callback: function($$v) {
    _vm.keywords = $$v;
  }, expression: "keywords" } }) : _vm._e()], 1);
};
var staticRenderFns = [];
function normalizeComponent(scriptExports, render2, staticRenderFns2, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
  var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
  if (render2) {
    options.render = render2;
    options.staticRenderFns = staticRenderFns2;
    options._compiled = true;
  }
  if (functionalTemplate) {
    options.functional = true;
  }
  if (scopeId) {
    options._scopeId = "data-v-" + scopeId;
  }
  var hook;
  if (moduleIdentifier) {
    hook = function(context) {
      context = context || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
      if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") {
        context = __VUE_SSR_CONTEXT__;
      }
      if (injectStyles) {
        injectStyles.call(this, context);
      }
      if (context && context._registeredComponents) {
        context._registeredComponents.add(moduleIdentifier);
      }
    };
    options._ssrRegister = hook;
  } else if (injectStyles) {
    hook = shadowMode ? function() {
      injectStyles.call(this, (options.functional ? this.parent : this).$root.$options.shadowRoot);
    } : injectStyles;
  }
  if (hook) {
    if (options.functional) {
      options._injectStyles = hook;
      var originalRender = options.render;
      options.render = function renderWithStyleInjection(h, context) {
        hook.call(context);
        return originalRender(h, context);
      };
    } else {
      var existing = options.beforeCreate;
      options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
    }
  }
  return {
    exports: scriptExports,
    options
  };
}
const __vue2_script = {
  defaultIcons: icons__default["default"],
  name: "EleIconPicker",
  mixins: [Locale__default["default"]],
  props: {
    value: String,
    placeholder: String,
    width: {
      type: Number,
      default: 380
    },
    data: {
      type: Array,
      default() {
        return icons__default["default"];
      }
    },
    size: String,
    readonly: {
      type: Boolean,
      default: true
    },
    disabled: Boolean,
    clearable: {
      type: Boolean,
      default: true
    },
    theme: String,
    search: {
      type: Boolean,
      default: true
    },
    searchPlaceholder: {
      type: String,
      default: "\u641C\u7D22..."
    }
  },
  data() {
    return {
      authenticated: license.checkLicense(),
      show: false,
      keywords: "",
      listShow: false,
      timer: null
    };
  },
  computed: {
    pickerClass() {
      return [
        "ele-icon-picker",
        { "ele-icon-picker-open": this.show },
        { "ele-icon-picker-style2": this.theme === "style2" },
        { "ele-icon-picker-style3": this.theme === "style3" }
      ];
    },
    result() {
      if (!this.keywords) {
        return this.data;
      }
      let result = [];
      this.data.forEach((item) => {
        result.push({
          title: item.title,
          icons: item.icons.filter((d) => d.indexOf(this.keywords) !== -1)
        });
      });
      return result;
    },
    active: {
      get() {
        if (!this.result || this.result.length === 0) {
          return null;
        }
        for (let i = 0; i < this.result.length; i++)
          if (this.result[i].icons.length !== 0) {
            return this.result[i].title;
          }
        return null;
      },
      set() {
      }
    }
  },
  methods: {
    choose(value) {
      this.show = false;
      this.$emit("input", value);
      this.$emit("change", value);
    },
    clear() {
      this.$emit("input", "");
      this.$emit("change", "");
    },
    setReadonly(e) {
      if (this.readonly) {
        e.target.readOnly = true;
      }
    },
    afterEnter() {
      if (this.timer) {
        clearTimeout(this.timer);
      }
      this.timer = setTimeout(() => {
        this.listShow = true;
      }, 50);
    },
    afterLeave() {
      if (this.timer) {
        clearTimeout(this.timer);
      }
      this.listShow = false;
    }
  }
};
const __cssModules = {};
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles, null, null, null);
function __vue2_injectStyles(context) {
  for (let o in __cssModules) {
    this[o] = __cssModules[o];
  }
}
var index = /* @__PURE__ */ function() {
  return __component__.exports;
}();
module.exports = index;
